package ManageGameHServer.code;

import org.json.JSONObject;

import ManageGameHServer.classFile.NoDBConnectO;
import redis.clients.jedis.Jedis;

public abstract class MiddleBusinessLoginWebWorker extends WebWorker {

	@Override
	public String execute() throws Exception {
        Jedis isMidlleLogin= NoDBConnectO.getCon();
        if(isMidlleLogin.exists(this.session)){
        	JSONObject sessionObject=new JSONObject(isMidlleLogin.get(this.session));
        	if(!sessionObject.isNull("isMidlleLogin") && sessionObject.getBoolean("isMidlleLogin")==true){ //登录成功
        		isMidlleLogin.setex(this.session, 600, sessionObject.toString());
        		return this.loginWorker();
        	}
        }else{    
        	return "<script>parent.location.href='/index/'</script>";
        }
        NoDBConnectO.redCon(isMidlleLogin);
		return null;
	}
	 public abstract String loginWorker() throws Exception;
}
